#include"mytext.h"
#include "CppUnitTest.h"
#include"../Modbus_rtu/rtu.h"
using namespace Microsoft::VisualStudio::CppUnitTestFramework;

namespace UnitTest
{		
	TEST_CLASS(UnitTest1)
	{
	public:
		
		TEST_METHOD(TestMethod1)
		{
			char input[600], output[600];
			char* FileAddress = "../analysis.ini";
			int num = 0, i = 0;
			num = ReadSection(FileAddress);
			vector<byte> in,a;
			for (i = 0; i < num; i++)
			{
				GetPrivateProfileStringA(section[i], "Input", 0, input, 600, FileAddress);
				GetPrivateProfileStringA(section[i], "Output", 0, output, 600, FileAddress);
				Logger::WriteMessage("*1*");
				string inp = input;
				if (inp.length() % 2 == 1)
					continue;
				stringtodec(inp, in);
				string res = rtu_data(in,a);
				string expect = output;
				Assert::AreEqual(expect, res);
				in.clear();
			}
		}

	};
}